<?php defined('IN_ADMIN') or exit('No permission resources.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>网站后台管理系统2.0---郑州腾石建站</title>
    <link href="<?php echo CSS_PATH?>green/style.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo CSS_PATH?>green/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH?>green/styles1.css" title="styles1" media="screen" />
    <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>green/styles2.css" title="styles2" media="screen" />
    <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>green/styles3.css" title="styles3" media="screen" />
    <script type="text/javascript" src="<?php echo JS_PATH?>jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo JS_PATH?>styleswitch.js"></script>
    <script type="text/javascript" src="<?php echo CSS_PATH?>green/Particleground.js"></script>
    <style type="text/css">html,body{height: 100%;position: relative;}</style>
    <script language="JavaScript">
    <!--
      if(top!=self)
      if(self!=top) top.location=self.location;
    //-->
    </script>
    <script>
    $(document).ready(function() {
    $('body').particleground({
    dotColor: 'rgba(255,255,255,0.2)',
    lineColor: 'rgba(255,255,255,0.2)'
    });
    });
    </script>
  </head>
  <style type="text/css">
  html,body{height: 100%;position: relative;background-color:#5fb878!important;background-image: linear-gradient(to right bottom, #0066CC , #5FB878)!important;}
  .admin_login{box-shadow:0 0 15px #555555;}
  </style>
  <body onload="javascript:document.myform.username.focus();" id="canvas">
    <div class="admin_login">
      <form action="index.php?m=admin&c=index&a=login&dosubmit=1" method="post" name="myform">
        <div class="admin_title">
          <strong>网站后台管理系统</strong>
          <em>TC Management System</em>
        </div>
        <div class="admin_user">
          <input type="text" name="username" placeholder="账号" class="login_txt">
        </div>
        <div class="admin_pwd">
          <input type="password" name="password" placeholder="密码" class="login_txt">
        </div>
        <div class="admin_val">
          <input type="text" name="code" placeholder="验证码" maxlength="4" class="login_txt left">
          <div id="yzm" class="right"><?php echo form::checkcode('code_img')?></div>
          <span id="status"></span>
        </div>
        <div class="admin_sub">
          <input type="submit" value="立即登陆" class="submit_btn">
        </div>
        <div class="admin_info">
          <p>技术支持：<a href="https://www.tengcee.com" target="_blank">郑州腾石建站</a></p>
        </div>
      </form>
    </div>
    <script>
      $(function(){
        var imgPath = "<?php echo IMG_PATH?>";
        //$("input[name=dosubmit]").attr('disabled',true).css({'background-color' : '#eee','color':'#999797'});
        $(".submit_btn").attr('disabled',true).css({'background-color' : '#eee','color':'#999','cursor': 'not-allowed'});;
        $("input[name=code]").bind("input propertychange",function(){
          var code = $.trim($(this).val());
          if(code == "" || code.length == 0){
              //$("input[name=code]").css('border','solid 1px red').focus();
              $(".admin_val").css('border','solid 1px red').focus();
              $("#status").html("<img src='"+imgPath+"cuo.png'>");
              $(".submit_btn").attr('disabled',true).css({'background-color' : '#eee','color':'#999','cursor': 'not-allowed'});;
            }else if(code.length != 4){
              $(".admin_val").css('border','solid 1px red').focus();
              $("#status").html("<img src='"+imgPath+"cuo.png'>");
              $(".submit_btn").attr('disabled',true).css({'background-color' : '#eee','color':'#999','cursor': 'not-allowed'});
            }else{
              $.ajax({
                url:"<?php echo SITE_PROTOCOL.SITE_URL.WEB_PATH;?>api.php?op=checklogincode",
                dataType:"json",
                data: {'code': code},
                type:'post',
                success:function(data){
                  if(data){
                    $("input[name=code]").css('border','none');
                    $("#status").html("<img src='"+imgPath+"dh.png'>");
                    $("input[name=dosubmit]").attr('disabled',false).css({'background-color' : '#fff','color':'#111'});
                    $(".submit_btn").attr('disabled',false).css({'background-color' : '#19aa8d','color':'#fff','cursor': 'pointer'});;
                }else{
                    $(".admin_val").css('border','solid 1px red').focus();
                    $("#status").html("<img src='"+imgPath+"cuo.png'>");
                    $(".submit_btn").attr('disabled',true).css({'background-color' : '#eee','color':'#999','cursor': 'not-allowed'});
                }
               }
              });
            }
        })
      });
    </script>
  </body>
</html>